 #include<stdio.h>
 #include<math.h>
 #include<sys/types.h>
 #include<time.h>
 #define N 30
 main()
 {
 	int i,n,cnt=0;
	float x,pi=3.14286;
	double ans=0.000,ans1=0.000,temp1[300],temp2[300];
	FILE *fp1,*fp2;
	fp1 = fopen("out1.txt","w");
	//fp2 = fopen("out2.txt","w");
	for( x = 0.1 ; x < 20 ; x = x + 0.1 )
	{
		for( n = 1 ; n <= N ; n = n+2 )
		{
			ans = ans + (sin(n*x))/n;
		}
		ans1 = ( 4*ans )/( pi ) ;
		temp1[cnt]=x;
		temp2[cnt] = ans1;
		printf("\n%f\t %f",x,ans1);
		fprintf(fp1,"\n%f\t %f",x,ans1);
		/*if(ans1 >= 0)
		 {
		  temp =ans1;
		 }*/
		 
		ans=0.0;
		ans1=0.0;
	}	
	fclose(fp1);
	return 0;
 }
 
 
 //./*.out > out.txt
 //gnuplot
 //plot "out.txt" with lines 12,0  (12- for colour)
